<?php

namespace app\common\Model;

use think\Model;

class Withdraw extends Model {
	/**
	 * 获取订单列表
	 *
	 * @param int $id        	订单ID
	 * @return array
	 */
	function getlist($map, $row = 50) {
		$pre = config ( 'database.prefix' );
		return db ( 'withdraw w' )->leftJoin ( "{$pre}member m", "m.user_id=w.user_id" )->where ( $map )->order ( 'id desc' )->field ( 'w.*,m.user_name' )->paginate ( $row );
	}
	function getInfo($map = '') {
		$pre = config ( 'database.prefix' );
		return db ( 'withdraw w' )->leftJoin ( "{$pre}member m", "m.user_id=w.user_id" )->where ( $map )->field ( 'w.*,m.user_name' )->find ();
	}
	function add($data) {
		return db ( 'withdraw' )->insertGetId ( $data );
	}
	function edit($map, $data) {
		return db ( 'withdraw' )->where ( $map )->update ( $data );
	}
	function del($map) {
		return db ( 'withdraw' )->where ( $map )->delete ();
	}
}

?>